// $Id$
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Globalization;
using System.Xml.Serialization;
using Salamanca.DataAccess;
using Salamanca.DataAccess.Collections;
using Salamanca.DataRules;
#if (!NET_CF)
using System.Diagnostics.CodeAnalysis;
#endif

namespace Northwind.DomainModel
{

    /// <summary />
    partial interface IEmployeeContainer
    {
        /// <summary />
      Employee Employee
        {
            get;
            set;
        }

    }

    /// <summary />
    partial interface IEmployeeMapper
    {

        /// <summary />
        Employee Find(Employee.PrimaryKey key, DataMapperCollection dataMappers);
        /// <summary />
        DomainModelKeyedCollection<Employee> FindAll(DataMapperCollection dataMappers);

    }

    /// <summary />
    partial class Employee
    {

        /// <summary />
        partial class PrimaryKey
        {
            /// <summary />
            public static implicit operator PrimaryKey(int key)
            {
                return new PrimaryKey(key);
            }

            /// <summary />
            public static explicit operator int(PrimaryKey key)
            {
                return key.Value;
            }

        }

        /// <summary />
        partial class DataTransfer
        {
            /// <summary />
#if (!NET_CF)
            [SuppressMessage("Microsoft.Design", "CA1051:DoNotDeclareVisibleInstanceFields")]
#endif
            public int EmployeeID;
            /// <summary />
#if (!NET_CF)
            [SuppressMessage("Microsoft.Design", "CA1051:DoNotDeclareVisibleInstanceFields")]
#endif
            public string LastName;
            /// <summary />
#if (!NET_CF)
            [SuppressMessage("Microsoft.Design", "CA1051:DoNotDeclareVisibleInstanceFields")]
#endif
            public string FirstName;
            /// <summary />
#if (!NET_CF)
            [SuppressMessage("Microsoft.Design", "CA1051:DoNotDeclareVisibleInstanceFields")]
#endif
            public string Title;
            /// <summary />
#if (!NET_CF)
            [SuppressMessage("Microsoft.Design", "CA1051:DoNotDeclareVisibleInstanceFields")]
#endif
            public string TitleOfCourtesy;
            /// <summary />
#if (!NET_CF)
            [SuppressMessage("Microsoft.Design", "CA1051:DoNotDeclareVisibleInstanceFields")]
#endif
            public System.DateTime? BirthDate;
            /// <summary />
#if (!NET_CF)
            [SuppressMessage("Microsoft.Design", "CA1051:DoNotDeclareVisibleInstanceFields")]
#endif
            public System.DateTime? HireDate;
            /// <summary />
#if (!NET_CF)
            [SuppressMessage("Microsoft.Design", "CA1051:DoNotDeclareVisibleInstanceFields")]
#endif
            public string Address;
            /// <summary />
#if (!NET_CF)
            [SuppressMessage("Microsoft.Design", "CA1051:DoNotDeclareVisibleInstanceFields")]
#endif
            public string City;
            /// <summary />
#if (!NET_CF)
            [SuppressMessage("Microsoft.Design", "CA1051:DoNotDeclareVisibleInstanceFields")]
#endif
            public string Region;
            /// <summary />
#if (!NET_CF)
            [SuppressMessage("Microsoft.Design", "CA1051:DoNotDeclareVisibleInstanceFields")]
#endif
            public string PostalCode;
            /// <summary />
#if (!NET_CF)
            [SuppressMessage("Microsoft.Design", "CA1051:DoNotDeclareVisibleInstanceFields")]
#endif
            public string Country;
            /// <summary />
#if (!NET_CF)
            [SuppressMessage("Microsoft.Design", "CA1051:DoNotDeclareVisibleInstanceFields")]
#endif
            public string HomePhone;
            /// <summary />
#if (!NET_CF)
            [SuppressMessage("Microsoft.Design", "CA1051:DoNotDeclareVisibleInstanceFields")]
#endif
            public string Extension;
            /// <summary />
#if (!NET_CF)
            [SuppressMessage("Microsoft.Design", "CA1051:DoNotDeclareVisibleInstanceFields")]
#endif
            public string Notes;

            /// <summary />
            public object Clone()
            {
                return MemberwiseClone();
            }

        }

        /// <summary />
        protected override Employee.PrimaryKey CreateId()
        {
            return new Employee.PrimaryKey(Data.EmployeeID);
        }

        /// <summary />
        internal Employee.PrimaryKey GetId()
        {
            return Id;
        }

        /// <summary />
        internal void SetId(int id)
        {
            Data.EmployeeID=id;
        }


        /// <summary />
#if (!NET_CF)
        [DataObjectMethod(DataObjectMethodType.Select, false)]
#endif
        public static Employee Find(Employee.PrimaryKey key, DataMapperCollection dataMappers)
        {
            return ((IEmployeeMapper)dataMappers[typeof(Employee)]).Find(key, dataMappers);
        }

        /// <summary />
#if (!NET_CF)
        [DataObjectMethod(DataObjectMethodType.Select, true)]
#endif
        public static IList<Employee> FindAll(DataMapperCollection dataMappers)
        {
            return ((IEmployeeMapper)dataMappers[typeof(Employee)]).FindAll(dataMappers);
        }

        /// <summary />
        internal bool InternalIsNew
        {
            get
            {
                return IsNew;
            }
        }

        /// <summary />
        private string _LastNameProperty
        {
            get
            {
                Load(true);
                return Data.LastName;
            }
            set
            {
                if (Data.LastName!=value)
                {
                    Data.LastName=value;
                }
            }
        }

        /// <summary />
        private string _FirstNameProperty
        {
            get
            {
                Load(true);
                return Data.FirstName;
            }
            set
            {
                if (Data.FirstName!=value)
                {
                    Data.FirstName=value;
                }
            }
        }

        /// <summary />
        private string _TitleProperty
        {
            get
            {
                Load(true);
                return Data.Title;
            }
            set
            {
                if (Data.Title!=value)
                {
                    Data.Title=value;
                }
            }
        }

        /// <summary />
        private string _TitleOfCourtesyProperty
        {
            get
            {
                Load(true);
                return Data.TitleOfCourtesy;
            }
            set
            {
                if (Data.TitleOfCourtesy!=value)
                {
                    Data.TitleOfCourtesy=value;
                }
            }
        }

        /// <summary />
        private System.DateTime? _BirthDateProperty
        {
            get
            {
                Load(true);
                return Data.BirthDate;
            }
            set
            {
                if (Data.BirthDate!=value)
                {
                    Data.BirthDate=value;
                }
            }
        }

        /// <summary />
        private System.DateTime? _HireDateProperty
        {
            get
            {
                Load(true);
                return Data.HireDate;
            }
            set
            {
                if (Data.HireDate!=value)
                {
                    Data.HireDate=value;
                }
            }
        }

        /// <summary />
        private string _AddressProperty
        {
            get
            {
                Load(true);
                return Data.Address;
            }
            set
            {
                if (Data.Address!=value)
                {
                    Data.Address=value;
                }
            }
        }

        /// <summary />
        private string _CityProperty
        {
            get
            {
                Load(true);
                return Data.City;
            }
            set
            {
                if (Data.City!=value)
                {
                    Data.City=value;
                }
            }
        }

        /// <summary />
        private string _RegionProperty
        {
            get
            {
                Load(true);
                return Data.Region;
            }
            set
            {
                if (Data.Region!=value)
                {
                    Data.Region=value;
                }
            }
        }

        /// <summary />
        private string _PostalCodeProperty
        {
            get
            {
                Load(true);
                return Data.PostalCode;
            }
            set
            {
                if (Data.PostalCode!=value)
                {
                    Data.PostalCode=value;
                }
            }
        }

        /// <summary />
        private string _CountryProperty
        {
            get
            {
                Load(true);
                return Data.Country;
            }
            set
            {
                if (Data.Country!=value)
                {
                    Data.Country=value;
                }
            }
        }

        /// <summary />
        private string _HomePhoneProperty
        {
            get
            {
                Load(true);
                return Data.HomePhone;
            }
            set
            {
                if (Data.HomePhone!=value)
                {
                    Data.HomePhone=value;
                }
            }
        }

        /// <summary />
        private string _ExtensionProperty
        {
            get
            {
                Load(true);
                return Data.Extension;
            }
            set
            {
                if (Data.Extension!=value)
                {
                    Data.Extension=value;
                }
            }
        }

        /// <summary />
        private string _NotesProperty
        {
            get
            {
                Load(true);
                return Data.Notes;
            }
            set
            {
                if (Data.Notes!=value)
                {
                    Data.Notes=value;
                }
            }
        }


        /// <summary />
        public static readonly IdentityMap<Employee.PrimaryKey, Employee> IdentityMap=new IdentityMap<Employee.PrimaryKey, Employee>();

    }

}
